<?php
/**
 * Created by JetBrains PhpStorm.
 * User:Mihail Markitan
 * Date: 11/1/11
 * Time: 1:27 AM
 */
?>
<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'invoice-ledger-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>


	<?php echo $form->errorSummary($model); ?>

    <div class="row">
		<?php echo $form->labelEx($model,'warehouse'); ?>
		<?php
        $models = Warehouse::model()->findAll();
        $data = CHtml::listData($models,'warehouseid','warehousedesc');
        echo $form->dropDownList($model,'warehouse',$data); ?>
		<?php echo $form->error($model,'warehouse'); ?>
	</div>

    <div class="row">
        <?php echo CHtml::label('Item','find') ?>
        <?php
        $data = Inventory::model()->findAllByAttributes(array());
        $source = array();
        foreach ($data as $item) {
          $source[] = $item->description;
        }

        $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
            'name'=>'find',
            'source'=>$source,
             'value'=>$model->description,
            // additional javascript options for the autocomplete plugin
            'options'=>array(
                'minLength'=>'1',
            ),
            'htmlOptions'=>array(
            ),
        ));

        ?>
    </div>

	<div class="row">
		<?php echo $form->labelEx($model,'description'); ?>
		<?php echo $form->textArea($model,'description',array('rows'=>5, 'cols'=>30)); ?>
		<?php echo $form->error($model,'description'); ?>
	</div>
     <div class="row">
		<?php echo $form->labelEx($model,'price'); ?>
        <div class="model-data" id= "itemprice">
            <?php if(!$model->isNewRecord) echo $model->price; ?>
        </div>
		<?php echo $form->error($model,'price'); ?>
	</div>
	<div class="row">
		<?php echo $form->labelEx($model,'qty'); ?>
		<?php echo $form->textField($model,'qty',array('size'=>10,'maxlength'=>10)); ?>
		<?php echo $form->error($model,'qty'); ?>
	</div>
    <div class="row">
		<?php echo CHtml::label('Amount','qty'); ?>
        <div class="model-data" id= "amountprice">

        </div>
	</div>



	<div class="row">
		<?php echo $form->labelEx($model,'noprint'); ?>
		<?php echo $form->checkBox($model,'noprint'); ?>
		<?php echo $form->error($model,'noprint'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'taxed'); ?>
		<?php echo $form->checkBox($model,'taxed'); ?>
		<?php echo $form->error($model,'taxed'); ?>
	</div>







	<div class="row buttons" style="float: none;">
	      <?php echo CHtml::submitButton('Update'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->